﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Net.Sockets;
using System.Text;
using WOS.Plugins.Remote;

namespace WOS.RemoteClient
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
          
            
        }
        RemoteManagerClient rm;
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            rm = new RemoteManagerClient();
            rm.ServerIP = this.txtIP.Text;
            rm.ServerPort = Convert.ToInt32(this.txtPort.Text);
            rm.CommandReceived += new EventHandler<CommandEventArgs>(rm_CommandReceived);
            rm.CommandSended += new EventHandler<CommandEventArgs>(rm_CommandSended);
            rm.Start();
        } 
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            if (rm != null)
            {
                rm.SendCommand(this.txtMessage.Text);
            }
        }
        void rm_CommandSended(object sender, CommandEventArgs e)
        {
           
        }
        void rm_CommandReceived(object sender, CommandEventArgs e)
        {
            this.lbCommands.Items.Add(e.Command.Name);
        }

       
    }
}
